<template>
  <main class="decision_model_container">
    <h2>决策模型管理</h2>
    <header class="flex flex-between">
      <div class="aside">
        <el-form
          :inline="true"
          :model="formInline"
          class="demo-form-inline"
          size="small"
        >
          <el-form-item label="模型名称：">
            <el-input
              v-model="formInline.mxmc"
              v-max-length-tip="30"
              v-no-space
              placeholder="请输入模型名称"
            ></el-input>
          </el-form-item>
          <el-form-item label="模型类型：">
            <el-input
              v-model="formInline.mxlx"
              v-max-length-tip="30"
              v-no-space
              placeholder="请输入模型类型"
            ></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">查询</el-button>
            <el-button type="primary" @click="onReset">重置</el-button>
          </el-form-item>
        </el-form>
      </div>
      <div class="aside">
        <el-form
          :inline="true"
          :model="formInline"
          class="demo-form-inline"
          size="small"
        >
          <!--          <el-form-item label="XXX检索：">-->
          <!--            <el-input v-model="formInline.sample" placeholder="请输入需要检索的XXX名称"></el-input>-->
          <!--          </el-form-item>-->
          <el-form-item>
            <el-button type="primary" @click="exportJcmxData">导出</el-button>
            <el-button type="primary" @click="deleteJcmxData"
              >批量删除</el-button
            >
            <el-button type="primary" @click="addModelAndAssess(0)"
              >添加模型</el-button
            >
          </el-form-item>
        </el-form>
      </div>
    </header>
    <main class="table_container">
      <el-table
        :data="tableData"
        style="width: 100%"
        stripe
        @selection-change="handleSelectionChange"
        class="mainTable"
        height="75vh"
      >
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column label="序号" type="index" width="55">
        </el-table-column>
        <el-table-column show-overflow-tooltip label="模型名称" prop="mxmc">
        </el-table-column>
        <el-table-column show-overflow-tooltip label="算法名称" prop="sfmc">
        </el-table-column>
        <el-table-column show-overflow-tooltip label="AI框架" prop="aikj">
        </el-table-column>
        <el-table-column show-overflow-tooltip label="开发语言" prop="kfyy">
        </el-table-column>
        <el-table-column show-overflow-tooltip label="运行环境" prop="yxhj">
        </el-table-column>
        <el-table-column show-overflow-tooltip label="模型类型" prop="mxlx">
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          label="模型构建方式"
          prop="mxgjfs"
        />
        <el-table-column show-overflow-tooltip label="决策速度" prop="jcsd">
        </el-table-column>
        <el-table-column show-overflow-tooltip label="总体准确率" prop="jczql">
        </el-table-column>
        <el-table-column show-overflow-tooltip label="版本信息" prop="bbxx">
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <span class="operation" @click="sampleEdit(scope.row)">编辑</span>
            <el-divider direction="vertical"></el-divider>
            <span class="operation" @click="startTrain(scope.row)"
              >训练及评估</span
            >
            <!--            <span class="operation" @click="addModelAndAssess(1)">评估</span>-->
          </template>
        </el-table-column>
      </el-table>
    </main>
    <footer class="fl_row_start">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page.sync="pageCurrent"
        :page-size="pageSize"
        layout="prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
    </footer>
    <el-dialog
      :title="addModalTitle"
      :visible.sync="dialogVisible"
      @close="cancelJcmxDialog"
    >
      <!-- :title="modelAndAssessBool ? '决策模型评估结果' : '添加模型'" -->
      <el-form
        ref="jcmxFrom"
        :label-position="labelPosition"
        label-width="140px"
        :model="formLabelAlign"
        :rules="rules"
        size="small"
        style="margin-top: 35px;align-items: initial"
      >
        <div style="display: flex;justify-content: center;">
          <div class="inputContainer">
            <el-form-item label="模型名称：" prop="mxmc">
              <el-input
                v-model="formLabelAlign.mxmc"
                v-max-length-tip="30"
                v-no-space
                placeholder="请输入模型名称"
              ></el-input>
            </el-form-item>
            <el-form-item label="AI框架：" prop="aikj">
              <el-select
                v-model="formLabelAlign.aikj"
                placeholder="请选择AI框架"
              >
                <el-option
                  v-for="(item, index) in aiFrameworkOption"
                  :key="index"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="运行环境：" prop="yxhj">
              <el-input
                v-model="formLabelAlign.yxhj"
                v-max-length-tip="30"
                v-no-space
                placeholder="请输入运行环境"
              ></el-input>
            </el-form-item>
            <el-form-item label="决策速度：" prop="jcsd">
              <el-input
                v-model="formLabelAlign.jcsd"
                v-only-number
                v-max-length-tip="10"
                v-no-space
                placeholder="请输入决策速度"
              ></el-input>
            </el-form-item>
            <el-form-item label="算法名称：" prop="sfmc">
              <el-input
                v-model="formLabelAlign.sfmc"
                v-max-length-tip="30"
                v-no-space
                placeholder="请输入算法名称"
              ></el-input>
            </el-form-item>
            <el-form-item label="模型构建方式：" prop="mxgjfs">
              <el-select
                v-model="formLabelAlign.mxgjfs"
                placeholder="请选择模型构建方式"
              >
                <el-option
                  v-for="(item, index) in modelBuildMethodOption"
                  :key="index"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </div>
          <div class="inputContainer">
            <el-form-item label="开发语言：" prop="kfyy">
              <el-select
                v-model="formLabelAlign.kfyy"
                placeholder="请输入开发语言"
              >
                <el-option
                  v-for="(item, index) in kfyyOptions"
                  :key="index"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="版本信息：" prop="bbxx">
              <el-input
                v-model="formLabelAlign.bbxx"
                v-max-length-tip="30"
                v-no-space
                placeholder="请输入版本信息"
              ></el-input>
            </el-form-item>
            <el-form-item label="总体准确率：" prop="jczql">
              <el-input
                v-model="formLabelAlign.jczql"
                v-only-number
                v-max-length-tip="10"
                v-no-space
                placeholder="请输入总体准确率"
              ></el-input>
            </el-form-item>
            <el-form-item label="模型类型：" prop="mxlx">
              <el-input
                v-model="formLabelAlign.mxlx"
                v-max-length-tip="30"
                v-no-space
                placeholder="请输入模型类型"
              ></el-input>
            </el-form-item>
            <div class="inputContainer_uplod">
              <el-form-item label="上传文件：" style="width: 88%;">
                <el-input
                  v-model="formLabelAlign.fileInfo.fileName"
                  placeholder="请选择上传文件"
                  readonly
                ></el-input>
              </el-form-item>
              <form id="fileForm">
                <input
                  type="file"
                  id="fileUpload"
                  name="file"
                  accept=".zip"
                  style="display: none;"
                />
                <el-button type="primary" size="mini" @click="selectWjButton"
                  >上传</el-button
                >
              </form>
            </div>
          </div>
        </div>
      </el-form>
      <!-- <div v-show="modelAndAssessBool">
        <div id="chart"></div>
      </div> -->
      <span slot="footer" class="dialog-footer">
        <el-button
          type="primary"
          :disabled="mxCommit"
          @click="mxpgAndSaveJcmxData"
          >确 定</el-button
        >
        <el-button @click="cancelJcmxDialog">取 消</el-button>
      </span>
    </el-dialog>
  </main>
</template>

<script src="./index.js"></script>
<style lang="scss" src="./index.scss" scoped></style>
